Installing the Javascript Code

There are several reports in Summary that require the use of client side Javascript to gather information about the clients browser. Getting these reports to work requires minor changes to your web pages. You should pick one or a small number of pages to modify, preferably the page(s) that are the primary entry point(s) for your site.

The Javascript code gathers information about the clients browser and passes that information back to the server as a request for the file '/log____image.gif' with additional information in the query string. Summary then uses this information to create the various browser reports. For this to work you must modify your HTML to include the Javascript code, below, and make sure your server is logging the query string. It is also a good idea to put a '/log____image.gif' file on your server. Having a file with that name is not critical, everything still works if the file is not found Many servers are faster serving a small file than an error. Also, it is nice to not have to see that request always showing up in the error reports. A small file with that name is provided.

Apache and other servers using NCSA Common or NCSA Combined log format will always log the needed information. To log it in WebSTAR you must include either the SEARCH_ARGS or CS-URI-QUERY log tokens (they are identical). Microsoft IIS will always log the needed information when using Microsoft or NCSA formats. Microsoft IIS using W3C format must be configured to include the 'URI Query' information.

There are three versions of the Javascript. The first is very simple and is placed in the <HEAD> section of your HTML. It logs the screen size, Java enabled state, and cookie enabled state. The second script also logs the window size. It is more complex because the window size is not always known until the page has been rendered. The third script adds logging of the installed plug-ins.

The first script is the simplest to install. The second is slightly more complex to install but tells you the clients browser window size. The third script gives you the most information, but it also sends back very large requests that take a small amount of extra time to process and more space in the log file.

These scripts are safe on any browser, but they will only gather and report information in newer browsers. Netscape Navigator/Communicator 4.x or newer, Microsoft Internet Explorer 4.x or newer, or the equivalent are required for the scripts to work. Since these browsers are quite common, the results are meaningful, but keep in mind that there is a bias towards newer machines.

Browser plug-in information can only be gathered from Netscape Navigator/Communicator 4.x or newer. Plug-in information is not available in any version of Internet Explorer.

Simple Script

The simple script only requires one addition to the HTML. It is the simplest to install but it does not log the window size or installed plug-ins.

Put this in the <HEAD> section of your HTML:

<script language="javascript1.2">
<!--
log_string="/log____image.gif?summarylog&je="+
navigator.javaEnabled()+"&sw="+screen.width+
"&sh="+screen.height;
if (document.layers)
{
document.cookie=1;
log_string+="&sd="+screen.pixelDepth+"&co="+
(document.cookie?true:false);
}
else log_string+="&sd="+screen.colorDepth+"&co="+
navigator.cookieEnabled;
log_li = new Image();
log_li.src = log_string;
//-->
</script>

Medium Script

The medium script adds window size, but still doesn't log plug-ins installed. This script provides the more information than the simple script but it is more complex to install. Instillation requires three separate additions to the HTML, including an 'onload' item in the BODY tag.

Put this in the <HEAD> section of your HTML:

<script language="javascript">
<!--
function whenReady() {}
//-->
</script>

Add this to the BODY tag:

onload="whenReady()"

it should look like this if you don't have any other options on the <BODY> tag:

<BODY onload="whenReady()">

Add this after the </BODY> tag but before the </HTML> tag:

<script language="javascript1.2">
<!--
function whenReady()
{
log_string="/log____image.gif?summarylog&je="+
navigator.javaEnabled()+"&sw="+screen.width+"&sh="+
screen.height;
if (document.layers)
{
document.cookie=1;
log_string+="&sd="+screen.pixelDepth+"&co="+
(document.cookie?true:false)+
"&ww="+innerWidth+"&wh="+innerHeight;
}
else
{
log_string+="&sd="+screen.colorDepth+"&co="+
navigator.cookieEnabled+"&ww="+
document.body.clientWidth+"&wh="+
document.body.clientHeight;
}
log_li = new Image();
log_li.src = log_string;
}
//-->
</script>

Full Script

The full script logs plug-ins installed for Netscape browsers and browser window size. This script provides the most information but it is more complex to install than the simple script, it takes very slightly more time to execute on the client browser, and it results in larger log files. Instillation requires three separate additions to the HTML, including an 'onload' item in the BODY tag.

Put this in the HEAD section of your HTML code:

<script language="javascript">
<!--
function whenReady() {}
//-->
</script>

Add this to the BODY tag:

onload="whenReady()"

it should look like this if you don't have any other options on the <BODY> tag:

<BODY onload="whenReady()">

Add this after the </BODY> tag but before the </HTML> tag.

<script language="javascript1.2">
<!--
function whenReady()
{
log_string="/log____image.gif?summarylog&je="+
navigator.javaEnabled()+"&sw="+screen.width+
"&sh="+screen.height;
if (document.layers)
{
document.cookie=1;
log_string+="&sd="+screen.pixelDepth+"&co="+
(document.cookie?true:false)+
"&ww="+innerWidth+"&wh="+innerHeight;
log_np=navigator.plugins;
for (log_i=log_np.length-1; log_i>=0; --log_i)
{
log_string+="&p=";
log_string+=escape(log_np[log_i].name);
}
}
else
{
log_string+="&sd="+screen.colorDepth+"&co="+
navigator.cookieEnabled+"&ww="+
document.body.clientWidth+"&wh="+
document.body.clientHeight;
}
log_li = new Image();
log_li.src = log_string;
}
//-->
</script>


Quick Start | Overview | Registering | Configuration
Javascript Code Installation | Virtual Domain Configuration | Questions
Reports | Log Formats and Servers | Frequently Asked Questions | Glossary

Copyright 1998,99 by Summary.Net - Updated 9/28/99